/*
 * Copyright (c) 2006-2021, RT-Thread Development Team
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * Change Logs:
 * Date           Author       Notes
 * 2025-06-04     31603       the first version
 */
#ifndef APPLICATIONS_INCLUDE_SG90_H_
#define APPLICATIONS_INCLUDE_SG90_H_

#include <rtdbg.h>
#include <rtthread.h>
#include <rtdef.h>
#include <drivers/pin.h>
#include <rtdevice.h>

#include "tim.h"


/* 定义线程控制块变量 begin */
#define                            PWM_THREAD_STACK_SIZE    1024
static  rt_uint8_t      PWM_stack[PWM_THREAD_STACK_SIZE];
struct  rt_thread       PWM_thread;

#define PWM_DEV_NAME        "pwm3"  /* PWM 设备名称 */
struct rt_device_pwm *pwm_dev;      /* PWM 设备句柄 */
#define PWM_DEV_CHANNEL1     1
#define PWM_DEV_CHANNEL2     2
#define PWM_DEV_CHANNEL3     3
#define PWM_DEV_CHANNEL4     4

int PWM_dev_init(void);
void pwm1_set_angle(int angle);
void pwm2_set_angle(int angle);
void pwm3_set_angle(int angle);
void pwm4_set_angle(int angle);


#endif /* APPLICATIONS_INCLUDE_SG90_H_ */
